package com.sunway.lc.ftp.camel;

import com.sunway.lc.ftp.process.FileCacheProcessor;
import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 下载ACC 参数信息到本地目录
 * @author Heyyroup
 * @date 2021/9/23
 */
@Component
public class AccEodRoute extends RouteBuilder {
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private FileCacheProcessor fileCacheProcessor;
    @Value("${acc.eod.source}")
    private String source;
    @Value("${acc.eod.target}")
    private String target;

    @Override
    public void configure() throws Exception {
        from(source)
                // 本地路径
                .to(target)
                .process(fileCacheProcessor)
                // 日志
                .log(LoggingLevel.INFO, logger, "下载参数组件: ${file:name} 完成.");
    }
}